"""
@title(TenX腾晓2024年11月考核答题文件)
@warning(请勿修改参数和返回值)
@warning(请认真填写__init__中的数据)
@author(1323230180)
"""
from typing import List, Tuple


class TenXClass:
    def __init__(self):
        self.name = "杨清桦"
        self.id = "3124002021"

    @staticmethod
    def question1(n: int) -> list[str]:
        print(n)  # 打印，防止IDE警告 
        A=[]
        for a in range(1,(n+1)):
            c=0
            d=0
            e=0
            while a!=0:
                b=0
                while ((a-a%(4**b))/(4**b))>=4:
                    b=b+1
                c=(a-a%(4**b))/(4**b)
                if c<4:
                    d=c*(10**b)
                    e=d+e
                    a=a-c*(4**b)
            e=int(e)
            e=str(e)
            A.append(e)
            e=float(e)
        return A

    @staticmethod
    def question2() -> list[tuple[int, int, int]]:
        a=0
        list=[]
        for a in range(0,15):
            b=0
            for b in range(0,101-a):
                c=100-a-b
                if(a*5+b*3+c*(1/3)<=100+0.01 and a*5+b*3+c*(1/3)>=100-0.01):
                    d=(a,b,c)
                    list.append(d)
        return list

    @staticmethod
    def question3(equipment: list[str], prop: list[str], material: list[str], items: list[str]) -> dict[str, list[str]]:
        print(equipment, prop, material, items)  # 打印，防止IDE警告
        list_1=[]
        list_2=[]
        list_3=[]
        dict={"equipment":list_1,"prop":list_2,"material":list_3}
        for a in items:
            if a in equipment:
                dict["equipment"].append(a)
            if a in prop:
                dict["prop"].append(a)
            if a in material:
                dict["material"].append(a)
        return dict

    @staticmethod
    def question4(item_values: dict[str, int], items: list[str]) -> tuple[list[str], int]:
        print(item_values, items)  # 打印，防止IDE警告
        A=[]
        B=[]
        for a in items:
            A.append(item_values[a])
        A.sort(reverse=True)
        g=A[0]+A[1]+A[2]
        for b,c in item_values.items():
            if A[0]==c:
                B.append(b)
            if A[1]==c:
                B.append(b)
            if A[2]==c:
                B.append(b)
        C=(B,g)
        return C

    @staticmethod
    def question5(matrix: list[list[int]]) -> list[tuple[int, int]]:
        print(matrix)  # 打印，防止IDE警告
        A=[]
        B=[]
        C=[]
        D=[]
        for a in matrix:
            A.append(len(a))
        b=len(A)
        for c in range(1,b+1):
            for d in range(1,A[c-1]+1):
                B.append((c,d))
        for e in matrix:
            for f in e:
                C.append(f)
        for g in range(0,len(C)):
            if C[g]==0:
                D.append(B[g])
        return D